<template>
    <el-form ref="departmentSearchForm" :model="departmentSearch" label-width="100px" :inline="true" size="small">
      <el-form-item label="部门名称" prop="companyName">
        <el-input v-model="departmentSearch.companyName"></el-input>
      </el-form-item>
      <el-form-item label="负责人" prop="leader">
        <el-input v-model="departmentSearch.leader"></el-input>
      </el-form-item>
      <el-form-item label="联系电话" prop="phone">
        <el-input v-model="departmentSearch.phone"></el-input>
      </el-form-item>
      <el-form-item class="btn">
        <el-button type="primary" icon="el-icon-search" @click="onSearch">搜索</el-button>
        <el-button icon="el-icon-refresh" @click="reset">重置</el-button>
      </el-form-item>
    </el-form>
  </template>
  
  <script>
  export default {
    props: {
      departmentSearch: {
        type: Object,
        required: true,
      },
    },
    methods:{
      onSearch(){
          this.$emit("onSearch");
      },
      reset(){
        this.$refs.departmentSearchForm.resetFields();
      }
    },
    beforeDestroy(){
      this.$refs.departmentSearchForm.resetFields();
    }
  };
  </script>
  
  <style scoped lang="scss">
  .el-button{
    padding-left: 25px;
    padding-right: 30px;
  }
  .btn{
    margin-left: 30px;
  }
  </style>
  